<template>
  <h1>我是首页的内容</h1>

  <button @click="toCart">跳转到购物车</button>
</template>

<script setup>
import { useRouter } from 'vue-router'

const router = useRouter()

function toCart() {
  router.push('/cart')
}

</script>